<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
  </head>
  <body>
    <div id="app">
      <async-item></async-item>
    </div>

    <script src="../js/vue.js"></script>

    <script>
      const app = Vue.createApp({
        data() {
          return {
            msg: "4536"
          }
        }
      });
      //注册全局异步组件
      app.component('async-item',Vue.defineAsyncComponent(()=>{
        return new Promise((resolve,reject) => {
          setTimeout(() => {
            resolve({
              template:`<div style="width: 200px; height: 200px; background-color: red;">laile</div>`
            })
          }, 3000);
        })
      }));
      app.mount('#app');
    </script>
  </body>
</html>